package routers

import (
	_ "gobackstage/code/controllers"
	"gobackstage/code/controllers/admin/public"
	"gobackstage/code/controllers/admin/index"
	"github.com/astaxie/beego"
	"gobackstage/code/controllers/admin/user"
)

func init() {
	beego.Router("/", &index.IndexController{})
	
	//登陆路由
	beego.Router("/admin/login", &public.LoginController{})
	//用户退出
	beego.Router("/admin/signout", &public.SignController{})

	//后台首页
	beego.Router("/admin/index", &index.IndexController{})

	/*
	 *用户管理
	 */
	beego.Router("/admin/user", &user.UserController{}) //用户列表
	beego.Router("/admin/user/edit", &user.UserController{}, "get:EditPage") //用户修改
	beego.Router("/admin/user/edit", &user.UserController{}, "post:EditFunc") //用户修改
	beego.Router("/admin/user/del/:id", &user.UserController{},"get:DelFunc") //用户删除
	beego.Router("/admin/user/add", &user.UserController{}, "get:AddPage;post:AddFunc") //用户添加

	beego.Router("/api/user/list", &user.UserController{}, "get:ApiListAll") //api接口: 取得后台管理员所有数据
	beego.Router("/api/user/editstatus", &user.UserController{}, "post:ApiEditStatus") //api接口: 后台管理员启用或者停用
	beego.Router("/api/user/del", &user.UserController{}, "post:ApiDel") //api接口: 后台管理员删除
	beego.Router("/api/user/add", &user.UserController{}, "get:AddPage;post:AddFunc") //用户添加
	beego.Router("/api/user/edit", &user.UserController{}, "get:EditPage;post:EditFunc") //用户修改
	beego.Router("/api/user/delall", &user.UserController{}, "post:ApiDelAll") //用户删除

}
